<#assign getIntText=localizedTextContext.getIntText>
<#assign getLongText=localizedTextContext.getLongText>


<#--########################以下是页面布局相关宏##########################-->
<#-- html -->
<#macro html>
	<!DOCTYPE html>
	<html>
		<#nested>
	</html>
</#macro>

<#-- head -->
<#macro head import=false title='' editor=true upload=true qrecord=false>
	<head>
		<!-- 字体 -------------------------------------------------------------------------------------------->
		<meta charset="UTF-8" />
		
		<!-- ie -------------------------------------------------------------------------------------------->
		<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
		
		<!-- 缓存关闭 ----------------------------------------------------------------------------------------->
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<title>${title}</title>
		<#if import>
		<script type="text/javascript">
    	var PROJECT_HOME="${base}";
    	</script>
		<!-- js -------------------------------------------------------------------------------------------->
		<!-- jquery -->
		<!--[if lt IE 9]>
		<script type="text/javascript" src="${base}/js/bfsu-bs/jquery/jquery-1.11.0.min.js"></script>
		<![endif]-->
		<!--[if gte IE 9]>
		<script type="text/javascript" src="${base}/js/bfsu-bs/jquery/jquery-2.1.0.min.js"></script>
		<![endif]-->
		<!--[if !IE]><!-->
		<script type="text/javascript" src="${base}/js/bfsu-bs/jquery/jquery-2.1.0.min.js"></script>
		<!--<![endif]-->
	
		
		<!-- bootstrap ------------------------------------------------------------------------------------------>
		<!-- 禁用缩放 -->
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="${base}/js/bfsu-bs/bootstrap/css/bootstrap.min.css">
		<script src="${base}/js/bfsu-bs/bootstrap/js/bootstrap.min.js"></script>
		
		<!-- less than ie9 need some js -->
		<!--[if lt IE 9]>
			<script src="${base}/js/bfsu-bs/css3-mediaqueries.js"></script>
			<script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script>
			<script src="http://cdn.bootcss.com/respond.js/1.3.0/respond.min.js"></script>
		<![endif]-->
		<!-- cdn 
		<link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">
		<script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
		-->
		
		<!-- icheck -->
		<!-- 
		<link rel="stylesheet" href="${base}/js/bfsu-bs/icheck-1.0.2/skins/all.css">
		<script type="text/javascript" src="${base}/js/bfsu-bs/icheck-1.0.2/icheck.min.js"></script>
		-->
		<!-- sco.js -->
		<link rel="stylesheet" href="${base}/js/bfsu-bs/sco.js-1.0.2/css/sco.message.css">
		<script type="text/javascript" src="${base}/js/bfsu-bs/sco.js-1.0.2/js/sco.message.js"></script>
		<!-- datetimepicker.js -->
		<link rel="stylesheet" href="${base}/js/bfsu-bs/datetimepicker/css/bootstrap-datetimepicker.min.css">
		<script type="text/javascript" src="${base}/js/bfsu-bs/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
		<script type="text/javascript" src="${base}/js/bfsu-bs/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
		<!-- combobox.js -->
		<link rel="stylesheet" href="${base}/js/bfsu-bs/combobox/css/bootstrap-combobox.css">
		<script type="text/javascript" src="${base}/js/bfsu-bs/combobox/js/bootstrap-combobox.js"></script>
		<!-- treeview.js -->
		<link rel="stylesheet" href="${base}/js/bfsu-bs/treeview/css/bootstrap-treeview.css">
		<script type="text/javascript" src="${base}/js/bfsu-bs/treeview/js/bootstrap-treeview.js"></script>
		<!-- validation.js -->
		<script type="text/javascript" src="${base}/js/bfsu-bs/bootstrap3-validation.js"></script>
		<script type="text/javascript" src="${base}/js/icourse.js"></script>
		<!-- multiselect.js -->
		<script type="text/javascript" src="${base}/js/bfsu-bs/multiselect/js/bootstrap-multiselect.js"></script>
		<script type="text/javascript" src="${base}/js/bfsu-bs/multiselect/css/bootstrap-multiselect.css"></script>
		<!-- holder.js -->
		<script type="text/javascript" src="${base}/js/holder.js"></script>
		<script>
		Holder.addTheme("gray", {
			background: "gray",
			foreground: "white",
			size: 6,
			font: "Monaco",
			fontweight: "normal"
		});
		</script>
		
		<!-- mine ------------------------------------------------------------------------------------------>
		<script type="text/javascript" src="${base}/js/bfsu-bs/bfsu.bs.js"></script>
		<link rel="stylesheet" href="${base}/style/bfsu.css">
		
		<script type="text/javascript" src="${base}/js/ueditor1_4_2/ueditor.config.js" ></script>
	    <script type="text/javascript" src="${base}/js/ueditor1_4_2/ueditor.all.min.js" ></script>
	    <script type="text/javascript" src="${base}/js/ueditor1_4_2/third-party/fill/fill.js" ></script>
	    <link rel="stylesheet" type="text/css" href="${base}/js/ueditor1_4_2/third-party/fill/fill.css">
	    </#if>
	    
	    <#if upload?exists && upload>
	    <link href="${base}/style/fileuploader/fileuploader.css" rel="stylesheet" type="text/css">
	    <script type="text/javascript" src="${base}/js/fileuploader/fileuploader.js"></script>
	    </#if>
	    
	    <!-- qrecord -->
	    <#if qrecord>
			<script type="text/javascript" src="${base}/js/_record/js/swfobject.js"></script>
			<script type="text/javascript" src="${base}/js/_record/js/recorder.js"></script>
			<script type="text/javascript" src="${base}/js/_record/js/main.js"></script>
			<link rel="stylesheet" href="${base}/js/_record/style.css">
	    </#if>
	    
		<#nested>
	</head>
</#macro>

<#-- body
	body的封装
	head	是否显示页头导航条，默认为false
	foot	是否显示页脚，默认为false
-->
<#macro body head=false foot=false>
	<body>
		<#if head><@bshead/></#if>
		<#nested/>
		<#if foot><@bsfoot/></#if>
	</body>
</#macro>


<#-- bshead
	页头，也就是页面顶部导航条
	pos		位置，默认为top
	sname	logo或者文字
	shref	点击logo跳转的地址
-->
<#macro bshead pos='top' sname='' shref='' fit=false>
	<nav role="navigation" class="navbar navbar-default" style="margin-bottom:0;">
		<div class="container<#if fit>-fluid</#if>">
			<div class="navbar-header">
				<button data-target="#bsnav" data-toggle="collapse" class="navbar-toggle" type="button">
					<span class="sr-only">导航条</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a href="${shref}" class="navbar-brand"><strong class="text-primary">${sname}</strong></a>
			</div>
			
			<div class="collapse navbar-collapse" id="bsnav">
				<ul class="nav navbar-nav">
					<#if Session['key_login_info_session']?exists>
						<@islearner>
							<li><a href="${base}/lms/fore/foreCourse/courseList">我的课程</a></li>
							<li><a href="${base}/lms/fore/learnerNote/index">我的笔记</a></li>
							<li><a href="${base}/lms/fore/learnerResource/index">我的资源</a></li>
							<li><a href="${base}/lms/fore/learnerStudyDetail/index">学习记录</a></li>
						</@islearner>
						<@notlearner>
							<@isadmin>
							<#--admin用户不判断菜单是否有权限
								<#list headmenus as menu>
									<li class="dropdown">
										<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">${menu.title}<#if menu.subMenus?exists><span class="caret"></span></#if></a>
										<#if menu.subMenus?exists>
											<ul class="dropdown-menu" role="menu">
												<#list menu.subMenus as smenu>
													<li role="presentation" style="padding:10px;"><a role="menuitem" style="padding-left:10px;" tabindex="-1" href="javascript:bfsu.html('${base}${smenu.url}', null, '${smenu.title}');">${smenu.title}</a></li>
												</#list>
											</ul>
										</#if>
									</li>
								</#list>
							-->
							</@isadmin>
							<@notadmin>
							<#--非admin用户需要判断菜单是否有权限，没有权限不显示菜单
								<#list headmenus as menu>
									<#if SecurityContext.hasMenu(menu, Session[BfsuolConstants.SESSION_LOGININFO_KEY]?exists.roleCodes)>
										<li class="dropdown">
											<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">${menu.title}<#if menu.subMenus?exists><span class="caret"></#if></span></a>
											<#if menu.subMenus?exists>
												<ul class="dropdown-menu" role="menu">
													<#list menu.subMenus as smenu>
														<#if SecurityContext.hasMenu(smenu, Session[BfsuolConstants.SESSION_LOGININFO_KEY]?exists.roleCodes)>
															<li role="presentation" style="padding:10px;"><a role="menuitem" style="padding-left:10px;" tabindex="-1" href="javascript:bfsu.html('${base}/${smenu.url}', null, '${smenu.title}');">${smenu.title}</a></li>
														</#if>
													</#list>
												</ul>
											</#if>
										</li>
									</#if>
								</#list>
							-->	
							</@notadmin>
						</@notlearner>
					<#else>
						<li><a href="#" target="_blank">课程介绍</a></li>
						<li><a href="#" target="_blank">关于我们</a></li>
					</#if>
					<#nested>
				</ul>
				<ul class="nav navbar-nav navbar-right">
					<#if Session['key_login_info_session']?exists>
				
						<ul  class="nav navbar-nav navbar-right">
							<li>
								<a role="menuitem" tabindex="-1" href="${base}/login/logout">退出系统</a>
							</li>
						</ul>
						<li class="dropdown">
							<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">个人信息<span class="caret"></span></a>
							<ul class="dropdown-menu" role="menu">
								<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0);" onclick="bfsu.edit('${base}/index/modifyPwdPre','修改密码');">修改密码</a></li>
								<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0);" onclick="bfsu.edit('${base}/index/personalInfoPre','修改个人信息');">修改个人信息</a></li>
								<li role="presentation" class="divider"></li>
							</ul>
						</li>
					<#else>
						<li id="loginli" class="dropdown <#if loginErrInfo?exists>open</#if>">
							<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">登录</a>
							<div class="dropdown-menu" role="menu" style="width:250px;height;250px;padding:20px;">
								<form role="form" action="${base}/login/logon">
									<div class="form-group">
										<label for="username">用户名</label>
										<input type="text" class="form-control" id="username" name="loginname" value="${loginname}" placeholder="用户名">
									</div>
									<div class="form-group">
										<label for="password">密码</label>
										<input type="password" class="form-control" id="password" name="password" placeholder="密码">
									</div>
									<div class="form-group">
										<input class="btn btn-lg btn-primary btn-block" type="submit" value="登录"/>
									</div>
									<#if loginErrInfo?exists>
										<div class="form-group">
											<h5 class="text-danger">${loginErrInfo}</h5>
										</div>
									</#if>
									<div class="form-group">
										<a href="javascript:void(0);" onclick="bfsu.add('${base}/login/toResetPassword','找回密码');">找回密码</a>
									</div>
								</form>
							</div>	
						</li>
					</#if>
				</ul>
			</div>
		</div>
	</nav>
</#macro>

<#-- bsfoot
	页脚，网页的页脚
	height	高度
	color	背景色
	content	显示的内容
-->
<#macro bsfoot height='60' color='#f5f5f5' content='北外在线（北京）教育科技有限公司'>
	<@row>
	<div class="footer" style="width:100%;height:${height}px;background-color:${color};text-align:center;">
		<div class="container">
			<p class="text-muted" style="margin: 20px 0;">
				<a target="_blank" href="http://www.ebeiwai.com/" >${content}</a>
			</p>
		</div>
	</div>
	</@row>
</#macro>

<#--Bootstrap页面容器
	container的封装，放置row的容器
	fit	是否铺满全屏，默认为false
-->
<#macro con fit=false>
	<div class="container<#if fit>-fluid</#if>" style="margin-top:20px;">
		<#nested>
	</div>
</#macro>

<#--Bootstrap布局行 
	row封装，和container配套使用
	fit	是否填充满container，默认为false
	id		id
	data	一些数据可以放到这里，通过js读取
-->
<#macro row fit=true id='' data=''>
	<div class="row<#if fit>-fluid</#if>" <#if id != ''>id="${id}"</#if> <#if data != ''>data="${data}"</#if>>
		<#nested>
	</div>
</#macro>
<#--Bootstrap布局单元格 
	col封装，和container配套使用
	id id
	url	单元格内容页
-->
<#macro col  class=''  id='' url=''>
	<div <#if class != ''>class="${class}"</#if> <#if id != ''>id="${id}"</#if>>
		<#if url!="">
			<script>
				$(function(){
					$.post('${url}',{},function(result){
					    $("#${id}").html(result);
					 });
				});
			</script>
		<#else>
			<#nested>
		</#if>
	</div>
</#macro>


<#--########################以上是页面布局相关宏##########################-->

<#--########################以下是组件相关宏##########################-->
<#-- panel
	panel封装
	title	panel的标题
	pid		如果有收缩需要，父容器的id
	sid		list中的key_index 
	unita	为课程列表使用
-->
<#macro panel open=true unita=false title='' pid='' sid=''>
	<div class="panel panel-default" style="height:100%;">
		<#if pid != ''>
			<div class="panel-heading">
				<h4 class="panel-title">
					<a data-toggle="collapse" data-parent="#${pid}" href="#collapse_${sid}" <#if unita>class="unita"</#if>>${title}</a>
				</h4>
			</div>
			<div id="collapse_${sid}" class="panel-collapse collapse <#if open>in</#if>">
				<div class="panel-body">
					<#nested>
				</div>
			</div>
		<#else>
			<#if title != ''>
				<div class="panel-heading">${title}</div>
			</#if>
			<div class="panel-body">
				<#nested>
			</div>
		</#if>
	</div>
</#macro>

<#-- table 
	表格封装
-->
<#macro table class=''>
	<div class="table-responsive">
		<table <#if class=''>class="table table-striped table-bordered table-hover"<#else>class="${class}"</#if>>
			<#nested>
		</table>
	</div>
</#macro>

<#-- bsicon 
	图标封装
	icon	具体的图标，可以查阅官方文档
-->
<#macro bsicon icon=''>
	<#if icon != ''>
		<span class="glyphicon glyphicon-${icon}"></span>
	</#if>
</#macro>

<#-- button 
	按钮
	type	类型，用来显示不同的颜色
	size	按钮大小
	icon	按钮图标
	onclick	点击事件
-->
<#macro button type="default" size='' icon='' onclick='' function="">
	<button type="button" class="btn btn-${type} <#if size != ''>btn-${size}</#if>" <#if onclick != ''>onclick="${onclick}"</#if>>
		<@bsicon icon=icon/>
		<#nested>
	</button>
</#macro>

<#-- progress 
	按钮
	type	类型，用来显示不同的颜色
	size	按钮大小
	icon	按钮图标
	onclick	点击事件
-->
<#macro progress rate='0'>
	<div class="progress">
		<div class="progress-bar" role="progressbar" aria-valuenow="${rate}" aria-valuemin="0" aria-valuemax="100" style="width:${rate}%;">${rate}%</div>
	</div>
</#macro>

<#-- nail
	缩略图，也就是页面的小块，可以放图片以及文字说明
	src		图片地址
	alt		图片提示
	title	文字标题
	desc	文字描述
-->
<#macro nail src='' alt='' title='' desc='' click='' tip='' fittitle=false>
	<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4" style="text-align:center;">
		<div class="thumbnail ctip" <#if tip!=''>title="${tip}"</#if>>
			<img <#if src!=''>src="${base}/${src}"</#if> data-src="holder.js/320x160/bright<#if tip!=''>/text:${tip}</#if>" alt="${alt}" style="width:280px;height:160px;<#if click!=''>cursor:pointer;</#if>" <#if click!=''>onclick="${click}"</#if>>
			<div class="caption">
				<#if title != ''><h1 <#if fittitle>style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"</#if>>${title}</h1></#if>
				<#if desc != ''><p>${desc}</p></#if>
				<p><#nested></p>
			</div>
		</div>
	</div>
</#macro>

<#-- lun 
	轮播组件，页面显示大图片轮播
	pics	图片名称，会寻找{base}/style/fore/images/${pic}.jpg
-->
<#macro lun pics...>
	<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
		<!-- Indicators -->
		<ol class="carousel-indicators">
			<#list pics as pic>
				<li data-target="#carousel-example-generic" data-slide-to="${pic_index}" <#if pic_index == 0>class="active"</#if>></li>
			</#list>
		</ol>
		
		<!-- Wrapper for slides -->
		<div class="carousel-inner" role="listbox">
			<#list pics as pic>
				<div class="item <#if pic_index == 0>active</#if>">
					<img src="${base}/style/fore/images/${pic}.jpg" alt="${pic}">
				</div>
			</#list>
		</div>
		
		<!-- Controls -->
		<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
			<span class="glyphicon glyphicon-chevron-left"></span>
			<span class="sr-only">Previous</span>
		</a>
		<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
			<span class="glyphicon glyphicon-chevron-right"></span>
			<span class="sr-only">Next</span>
		</a>
	</div>
</#macro>

<#-- clun 
	轮播组件，页面显示大图片轮播，为课件展示定制
-->
<#macro clun id img='' alt='alt'>
	<div id="carousel-example-generic-${id}" class="carousel slide" data-ride="carousel">
		<!-- Indicators -->
		<ol class="carousel-indicators">
			<li data-target="#carousel-example-generic-${id}" data-slide-to="0" class="active"></li>
			<li data-target="#carousel-example-generic-${id}" data-slide-to="1"></li>
		</ol>
		
		<!-- Wrapper for slides -->
		<div class="carousel-inner" role="listbox">
			<div class="item active">
				<#if img!=''>
					<img src="${base}/${img}" alt="${alt}" style="widht:500px;height:250px;">
				<#else>
					<img data-src="holder.js/500x250/sky">
				</#if>
			</div>
			<div class="item">
				<img data-src="holder.js/500x250/sky/text: ">
				<div class="carousel-caption">
					<#nested>
				</div>
			</div>
		</div>
		
		<!-- Controls -->
		<a class="left carousel-control" href="#carousel-example-generic-${id}" role="button" data-slide="prev">
			<span class="glyphicon glyphicon-chevron-left"></span>
			<span class="sr-only">Previous</span>
		</a>
		<a class="right carousel-control" href="#carousel-example-generic-${id}" role="button" data-slide="next">
			<span class="glyphicon glyphicon-chevron-right"></span>
			<span class="sr-only">Next</span>
		</a>
	</div>
</#macro>

<#--导航宏 -->
<#macro nav navs...>
	<#assign navList=navs>
</#macro>

<#-- formgroup -->
<#macro formgroup  type='text' title='title' name='name' value='' tipid='' expend=false>
	<@row>
	<div class="form-group">
		<label class="control-label col-xs-3 col-sm-3 col-md-3 col-lg-3">${title}：</label>

		<#if expend>
			<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9 form-control-static">
			    <#nested>
			</div>
			<#if tipid!=''>
			<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" <#if tipid!=''>id="${tipid}"</#if> class="help-block" style="color:red">*</div>
			</#if>
		<#else>
			<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5 form-control-static">
			    <#nested>
			</div>
			<#if tipid!=''>
			<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3" <#if tipid!=''>id="${tipid}"</#if> class="help-block" style="color:red">*</div>
			</#if>
		</#if>
	</div>
	</@row>
	
</#macro>
<#-- querygroup -->
<#macro querygroup inc=true type='text' title='title' name='name' value=''>
	<div class="form-group">
		<div class="input-group">
			<div class="input-group-addon">${title}：</div>
			<#nested>
		</div>
	</div>
</#macro>


<#--
下拉列表框
    name                名称
    value               值可以是数组
    list                集合
    listKey=''          选项内容对应的方法名
    listValue=''        选项的值对应的方法名
    headerKey=''        头选项的显示
    headerValue=''      头选项的值
    emptyOption=false   包含一个空的选项
    id=''               ID
    class=''            样式表
    style=''            样式
    title=''            提示信息
    disabled=false      不可用
    size=-1             显示数量
    tabindex=-1         tab顺序
-->
<#macro select name list value='' listKey='' listValue='' headerKey='' headerValue='' emptyOption=true id='' class='' style='' title='' disabled=false size=-1 tabindex=-1 onChange='' checkType='' sortBy='' multi=true search=true>

    <select <#if multi> multiple="multiple" </#if> name="${name}"<#if id?exists && id!=''> id="${id}"</#if> <#if class?exists && class!=''> class="${class}<#if multi> multiselect</#if>"<#else>class="multiselect"</#if>  <#if style?exists && style!=''> style="${style}"</#if> <#if checkType?exists && checkType!=''> check-type="${checkType}"</#if> <#if title?exists && title!=''> title="${title}"</#if><#if size gt 0> size="${size}"</#if><#if disabled> disabled="disabled"</#if><#if tabindex gt 0> tabindex="${tabindex}"</#if> <#if onChange?exists && onChange!=''>onChange='${onChange}'</#if> >
    
    <#if headerKey?exists && headerKey!=''>
        <option value="${headerValue}"<#if headerValue==value> selected="selected"</#if> >${headerKey}</option>
    </#if>
    
    <#if emptyOption&&multi=false>
        <option value="">请选择</option>
    </#if>
    <#if sortBy?exists&&sortBy!=''>
	    <#if listKey?exists && listKey!='' && listValue?exists && listValue!=''>
	        <#list list?exists?sort_by(sortBy) as item>
	            <#assign itemTitle=item[listKey]>
	            <#assign itemValue=item[listValue]>
	        <option value="${itemValue}" <#if itemValue == value> selected="selected"</#if> >${itemTitle}</option>
	        </#list>
	    <#elseif list?is_hash&&!list?is_collection>
	        <#list list?exists?sort_by(sortBy)?keys as key>
	            <#assign itemTitle=key>
	            <#assign itemValue=list[key]>
	        <option value="${itemValue}" <#if itemValue == value> selected="selected"</#if> >${itemTitle}</option>
	        </#list>
	    <#else>
	        <#list list?exists?sort_by(sortBy) as item>
	            <#assign itemTitle=getText(item?string)>
	            <#assign itemValue=item>
	        <option value="${itemValue}" <#if itemValue == value> selected="selected"</#if> >${itemTitle}</option>
	        </#list>
	    </#if>
    <#else>
    	<#if listKey?exists && listKey!='' && listValue?exists && listValue!=''>
	        <#list list?exists as item>
	            <#assign itemTitle=item[listKey]>
	            <#assign itemValue=item[listValue]>
	        <option value="${itemValue}" <#if itemValue == value> selected="selected"</#if> >${itemTitle}</option>
	        </#list>
	    <#elseif list?is_hash&&!list?is_collection>
	        <#list list?exists?keys as key>
	            <#assign itemTitle=key>
	            <#assign itemValue=list[key]>
	        <option value="${itemValue}" <#if itemValue == value> selected="selected"</#if> >${itemTitle}</option>
	        </#list>
	    <#else>
	        <#list list?exists as item>
	            <#assign itemTitle=getText(item?string)>
	            <#assign itemValue=item>
	        <option value="${itemValue}" <#if itemValue == value> selected="selected"</#if> >${itemTitle}</option>
	        </#list>
	    </#if>
    </#if>
    </select>
   
    <script type="text/javascript">
    $(document).ready(function(){
    	$('#${id}').multiselect({nonSelectedText:'请选择',numberDisplayed:6,enableCaseInsensitiveFiltering:<#if search>true<#else>false</#if><#if multi&&value!=''>,select:'${value}'</#if>});
    });
    	
    </script>
   
    
</#macro>
<#--
联动ajax下来选择框
    name            名称
    id              Id
    url             ajax的地址，如果是联动，则在url中应有[pid]的标签，自动替换对应的值
    value=''        默认选择的值，可以是数组
    pid=''          父选择框的Id
    class=''        样式表
    title=''        标题
    disabled=false  是否可用
    size=-1         同时选择的数量
    tabindex=-1     Tab键的顺序
-->
<#macro ajaxselect name id url value='' pid='' class='' title='' valueField='id' textField='text' style='' disabled=false size=-1 tabindex=-1 onChange='' checkType='' multi=false search=true>
    <select name="${name}" id="${id}"<#if multi> multiple="multiple" </#if> name="${name}"<#if id?exists && id!=''> id="${id}" </#if> <#if class?exists && class!=''> class="${class}<#if multi> multiselect</#if>"<#else>class="multiselect"</#if> <#if title?exists && title!=''> title="${title}"</#if><#if size gt 0> size="${size}"</#if> <#if style?exists && style!=''> style="${style}"</#if> <#if checkType?exists && checkType!=''> check-type="${checkType}"</#if> <#if disabled> disabled="disabled"</#if><#if tabindex gt 0> tabindex="${tabindex}"</#if> <#if onChange?exists && onChange!=''>onChange='${onChange}'</#if>></select>
    <script type="text/javascript">
    $(document).ready(function(){
    	var url='${url}';
    	<#if pid?exists && pid!=''>
    	var $pid=$('#${pid}');
    	if($pid&&url.indexOf('[')>-1 && url.indexOf(']')>-1){
    		 $pid.change (function(){
                var reloadurl='${url}';
                var val = $('#${pid}').val();
                if(val==null||val=='') return ;
                reloadurl = reloadurl.replace('[${pid}]',val);
                $('#${id}').html('');
                $('#${id}').multiselect({nonSelectedText:'请选择',numberDisplayed:6,enableCaseInsensitiveFiltering:<#if search>true<#else>false</#if><#if multi&&value!=''>,select:'${value}'</#if>});
			    $('#${id}').multiselect('rebuild');
                bfsu.ajaxSubmit({
					url:reloadurl,
			    	dataType:'json',
			    	onSuccess:function(data){
			    		var op = "<option value=''>请选择</option>";
			    		for(var i=0;i<data.length;i++){
				    		op += "<option value='"+data[i].${valueField}+"'>"+data[i].${textField}+"</option>";
			    		}
			    		$('#${id}').html(op);
						$('#${id}').multiselect({nonSelectedText:'请选择',numberDisplayed:6,enableCaseInsensitiveFiltering:<#if search>true<#else>false</#if><#if multi&&value!=''>,select:'${value}'</#if>});
			    		$('#${id}').multiselect('rebuild');
				    }
    			});
            });
            var val=$pid.val();
        	if(val!=null&&val!=''){
                url = url.replace('[${pid}]',val);
                bfsu.ajaxSubmit({
					url:url,
			    	dataType:'json',
			    	onSuccess:function(data){
			    		var op = "<option value=''></option>";
			    		for(var i=0;i<data.length;i++){
			    			if(data[i].${valueField}=='${value}'){
				    			op += "<option value='"+data[i].${valueField}+"' selected='selected'>"+data[i].${textField}+"</option>";
				    		}else{
				    			op += "<option value='"+data[i].${valueField}+"'>"+data[i].${textField}+"</option>";
				    		}
			    		}
			    		$('#${id}').html(op);
			    		$('#${id}').multiselect({nonSelectedText:'请选择',numberDisplayed:6,enableCaseInsensitiveFiltering:<#if search>true<#else>false</#if><#if multi&&value!=''>,select:'${value}'</#if>});
			    		$('#${id}').multiselect('rebuild');
		                
			    	}
    			});
                
            }
           
    	}
    	<#else>
		bfsu.ajaxSubmit({
				url:url,
		    	dataType:'json',
		    	onSuccess:function(data){
		    		var op = "<option value='' selected='selected'>请选择</option>";
		    		for(var i=0;i<data.length;i++){
		    			if(data[i].${valueField}=='${value}'){
			    			op += "<option value='"+data[i].${valueField}+"' selected='selected'>"+data[i].${textField}+"</option>";
			    		}else{
			    			op += "<option value='"+data[i].${valueField}+"'>"+data[i].${textField}+"</option>";
			    		}
		    		}
		    		$('#${id}').html(op);
               		$('#${id}').multiselect({nonSelectedText:'请选择',numberDisplayed:6,enableCaseInsensitiveFiltering:<#if search>true<#else>false</#if><#if multi&&value!=''>,select:'${value}'</#if>});
	    			$('#${id}').multiselect('rebuild');
		    	}
			});
    	</#if>
            
    });
    
    </script>
</#macro>

<#--
复选钮
    name                名称
    value               值
    checked=false       是否选中
    id=''               ID
    class=''            样式表
    title=''            提示信息
    disabled=false      不可用
    readonly=false      是否只读
    tabindex=-1         tab顺序
-->
<#macro checkbox name value='' checked=false id='' class='' style='' title='' readonly=false disabled=false tabindex=-1 >
   <div class='checkbox-inline'><label> <input type="checkbox" name="${name}" value="${value}" <#if checked?exists && checked> checked="checked"</#if><#if id?exists && id!=''> id="${id}"</#if><#if class?exists && class!=''> class="${class}"</#if><#if style?exists && style!=''> style="${style}"</#if><#if disabled> disabled="disabled"</#if><#if readonly> readonly="readonly"</#if><#if tabindex gt 0> tabindex="${tabindex}"</#if> ><#if title?exists && title!=''> ${title}</#if></label></div>
</#macro>

<#--
复选钮列表
    name                名称
    value               值
    list                集合
    listKey=''          选项内容对应的方法名
    listValue=''        选项的值对应的方法名
    fieldValue=''       选取的值
    class=''            样式表
    title=''            提示信息
    disabled=false      不可用
    readonly=false      是否只读
-->
<#macro checkboxlist name list value='' listKey='' listValue='' class=''  disabled=false readonly=false>
    <#if listKey?exists && listKey!='' && listValue?exists && listValue!=''>
    	
        <#list list?exists as item>
       		<#assign itemTitle=item>
	    	<#list listKey?split('.') as k>
	    		<#assign itemTitle=itemTitle[k]>
	    	</#list>
            <#assign itemValue=item>
	    	<#list listValue?split('.') as k>
	    		<#assign itemValue=itemValue[k]>
	    	</#list>
            <#if value?exists && value?has_content>
                <#if value?is_enumerable>
                    <#assign checked=(value?seq_contains(itemValue))>
                <#else>
            	   <#assign checked=(value==itemValue)>
            	</#if>
            <#else>
                <#assign checked=false>
            </#if>
            <@checkbox name=name value=itemValue checked=checked id=(itemTitle+'_'+itemValue) class=class title=itemTitle readonly=readonly disabled=disabled /><label for="${itemTitle+'_'+itemValue}"></label>
        </#list>
    <#elseif list?is_hash&&!list?is_collection>
        <#list list?exists?keys as key>
            <#assign itemTitle=key>
            <#assign itemValue=list[key]>
            <#if value?exists && value?has_content>
                <#if value?is_enumerable>
                    <#assign checked=(value?seq_contains(itemValue))>
                <#else>
                   <#assign checked=(value==itemValue)>
                </#if>
            <#else>
                <#assign checked=false>
            </#if>
            <@checkbox name=name value=itemValue checked=checked id=(itemTitle+'_'+itemValue) class=class title=itemTitle readonly=readonly disabled=disabled /><label for="${itemTitle+'_'+itemValue}"></label>
        </#list>
    <#else>
        <#list list?exists as item>
            <#assign itemTitle=getText(item?string)>
            <#assign itemValue=item>
            <#if value?exists && value?has_content>
                <#if value?is_enumerable>
                    <#assign checked=(value?seq_contains(itemValue))>
                <#else>
                   <#assign checked=(value==itemValue)>
                </#if>
            <#else>
                <#assign checked=false>
            </#if>
            <@checkbox name=name value=itemValue checked=checked id=(itemTitle+'_'+itemValue) class=class title=itemTitle readonly=readonly disabled=disabled /><label for="${itemTitle+'_'+itemValue}"></label>
        </#list>
    </#if>
</#macro>

<#--
单选钮
    name                名称
    value               值
    list                集合
    listKey=''          选项内容对应的方法名
    listValue=''        选项的值对应的方法名
    fieldValue=''       选取的值
    class=''            样式表
    title=''            提示信息
    disabled=false      不可用
    readonly=false      是否只读
-->
<#macro radiobox name list value='' listKey=''style='' listValue='' class='' title='' disabled=false style='' readonly=false>
    <#if listKey?exists && listKey!='' && listValue?exists && listValue!=''>
        <#list list?exists as item>
            <#assign itemTitle=item[listKey]>
            <#assign itemValue=item[listValue]>
            <#if value?exists && value?has_content>
                <#if value?is_enumerable>
                    <#assign checked=(value?seq_contains(itemValue))>
                <#else>
                   <#assign checked=(value==itemValue)>
                </#if>
            <#else>
                <#assign checked=false>
            </#if>
            <div class='radio-inline' <#if style?exists && style!=''> style="${style}"</#if>><input type="radio" name="${name}" value="${itemValue}" id="${itemTitle+'_'+itemValue}" <#if checked> checked="checked"</#if><#if class?exists && class!=''> class="${class}"</#if><#if title?exists && title!=''> title="${title}"</#if><#if disabled> disabled="disabled"</#if><#if readonly> readonly="readonly"</#if> ><label for="${itemTitle+'_'+itemValue}">${itemTitle}</label></div>
        </#list>
    <#elseif list?is_hash_ex&&!list?is_collection>
        <#list list?exists?keys as key>
            <#assign itemTitle=key>
            <#assign itemValue=list[key]>
            <#if value?exists && value?has_content>
                <#if value?is_enumerable>
                    <#assign checked=(value?seq_contains(itemValue))>
                <#else>
                   <#assign checked=(value==itemValue)>
                </#if>
            <#else>
                <#assign checked=false>
            </#if>
            <div class='radio-inline' <#if style?exists && style!=''> style="${style}"</#if>><input type="radio" name="${name}" value="${itemValue}" id="${itemTitle+'_'+itemValue}" <#if checked> checked="checked"</#if><#if class?exists && class!=''> class="${class}"</#if><#if title?exists && title!=''> title="${title}"</#if><#if disabled> disabled="disabled"</#if><#if readonly> readonly="readonly"</#if> ><label for="${itemTitle+'_'+itemValue}">${itemTitle}</label></div>
        </#list>
    <#else>
        <#list list?exists as item>
            <#assign itemTitle=getText(item?string)>
            <#assign itemValue=item>
            <#if value?exists && value?has_content>
                <#if value?is_enumerable>
                    <#assign checked=(value?seq_contains(itemValue))>
                <#else>
                   <#assign checked=(value==itemValue)>
                </#if>
            <#else>
                <#assign checked=false>
            </#if>
            <div class='radio-inline' <#if style?exists && style!=''> style="${style}"</#if>><input type="radio" checkbox name="${name}" value="${itemValue}" id="${itemTitle+'_'+itemValue}" <#if checked> checked="checked"</#if><#if class?exists && class!=''> class="${class}"</#if><<#if title?exists && title!=''> title="${title}"</#if><#if disabled> disabled="disabled"</#if><#if readonly> readonly="readonly"</#if> ><label for="${itemTitle+'_'+itemValue}">${itemTitle}</label></div>
        </#list>
    </#if>
</#macro>

<#--上传区宏-->
<#macro upload fileInfo="" id="default" uploadPath="" datepath="true" format="true" fileId="fileId" multiple='true' buttonText="上传文件">
    <div id="file-uploader-${id}" ></div>
    <script type="text/javascript">
        new qq.FileUploader({
                element: document.getElementById('file-uploader-${id}'),
                action: '${base}/components/fileupload/upload?path=${uploadPath}&datepath=${datepath}&format=${format}',
                deleteUrl:'${base}/components/fileupload/delete/',
                multiple:${multiple},
                uploadButtonText:'${buttonText}',
                fileIdInputName:'${fileId}',
                <#if fileInfo?exists && fileInfo!="" && fileInfo.hasFiles>
                files:${fileInfo.fileInfos},
                </#if>
                debug: true
            });      
    </script>
</#macro>

<#-- 
隐藏的录音组件 
id
-->
<#macro hrecord>
	<@qrecord style="display:none;"/>
</#macro>

<#-- 
录音组件 
head中必须使用qrecord=true，
若上传成功后会把上传的文件id放到qrecordId这个里面，
可以通过qrecordId去fileManager表中查找文件相关信息。
-->
<#macro qrecord style=''>
<#--
	<div class="qcontainer" id="myRecordDiv" <#if style!=''>style="${style}"</#if>>
		<div id="recorder-audio" class="control_panel idle">
			<button class="record_button" onclick="FWRecorder.record('audio', 'audio.wav');" title="Record">
				<img src="${base}/js/_record/images/record.png" alt="Record" />
			</button>
			<button class="stop_recording_button" onclick="FWRecorder.stopRecording('audio');" title="Stop Recording">
				<img src="${base}/js/_record/images/stop.png" alt="Stop Recording" />
			</button>
			<button class="play_button" onclick="FWRecorder.playBack('audio');" title="Play">
				<img src="${base}/js/_record/images/play.png" alt="Play" />
			</button>
			<button class="pause_playing_button" onclick="FWRecorder.pausePlayBack('audio');" title="Pause Playing">
				<img src="${base}/js/_record/images/pause.png" alt="Pause Playing" />
			</button>
			<button class="stop_playing_button" onclick="FWRecorder.stopPlayBack();" title="Stop Playing">
				<img src="${base}/js/_record/images/stop.png" alt="Stop Playing" />
			</button>
			<div class="level"></div>
		</div>
	
		<div class="details">
			<button class="show_level" onclick="FWRecorder.observeLevel();">显示声波</button>
			<button class="hide_level" onclick="FWRecorder.stopObservingLevel();" style="display: none;">隐藏声波</button>
			<button class="show_settings" onclick="microphonePermission()">麦克风权限</button>
			<span id="save_button" style="display:inline-block;"> 
				<span id="flashcontent">
					<p>您的浏览器必须支持Javascript,而且安装了Flash播放器！</p> 
				</span> 
			</span>
			<div id="status">录音状态。。。</div>
			<div>录音时长：<span id="duration"></span></div>
			<div>上传状态：<span id="upload_status"></span></div>
			<input type="hidden" id="qrecordId"/>
		</div>
	
		<form id="uploadForm" name="uploadForm" action="${base}/common/record/upload">
			<input name="authenticity_token" value="xxxxx" type="hidden">
			<input name="upload_file[parent_id]" value="1" type="hidden">
			<input name="format" value="json" type="hidden">
		</form>
	</div>
-->
</#macro>

<#--
attrs 是数组 元素是key value 关于展示的属性
例 [{"name":"名称","value":"title"},{.....}]
	  名称:国家行政学院
	  .....
-->
<#macro tree list attrs values=[] listKey='' listValue='' expand=false casCheck=false checkbox=false checkboxName='id'>
	
    <#assign pid=''>
	<#if list?has_content>
		<table class="table table-hover tableTree">
			 <#list list?exists as item>
	            <#assign itemTitle=item[listKey]>
	            <#assign itemValue=item[listValue]>
	            <#assign levelTrack=item['levelTrack']>
				<#assign length=levelTrack?split(',')?size/>
				<#assign pIndex=item_index-1/>
				
	            <tr id='${itemValue}' class='' data-id=${itemValue}>
            		<td >
		            	<#if checkbox>
            				<input type="checkbox" name="${checkboxName}" class="checkid" value=${itemValue}/>
	    	        	</#if>
	    	        	&nbsp;&nbsp;<span  class="glyphicon glyphicon-plus slideElement" style="cursor:pointer;"></span> 
	    	        	&nbsp;&nbsp;&nbsp;${itemTitle}
    	        	</td>
	    	        	<#list attrs?exists as attr>
    	        			<td>
			    	        	&nbsp;&nbsp;${attr.name}:
			    	        	<#if item[attr.value] == null || item[attr.value] =="">
			    	        		暂无
	    	        			<#else>
				    	        	${item[attr.value]}
			    	        	</#if>
    	        			</td>
	    	        	</#list>
    	        	<td data-id=${itemValue}>
    	       		 <#nested>
            		</td>
	            </tr>
	            <#if length != null>
	            	<script>
	            		$(function(){
	            			if(${length} == 1){
	            				$("#${itemValue}").addClass("p");
	            			}else{
	            				var $item = $('#${itemValue} td:eq(0)');
	            				for(i=0;i<${length} ;i++){
		            				$item.prepend("&nbsp;&nbsp;");
	            				}
	            				$("#${itemValue}").addClass("${levelTrack?split(',')[length-2]}");
	            			}
	            		});
	            	</script>
	            </#if>
	             <#assign pid=itemValue>
            </#list>
		</table>
	</#if>
	<script>
//初始化
$(function(){
	<#if !expand>
		$(".tableTree tr:not('.p')").hide();
	</#if>
	$(".tableTree tr.p").each(function(){
		hideIcon($(this).data("id"));		
	});
});

//如果有子节点的话图标变成“+”
function hideIcon(classId){
	var $sonEle = $("."+classId);
	if($sonEle.length > 0){
		$sonEle.each(function(){
			hideIcon($(this).data("id"));
		});
	}else{
		$('#'+classId+" td span.slideElement").removeClass("glyphicon-plus").removeClass("glyphicon-minus");
	}
}

//判断是否有子节点
function hasSonEle(classId){
	if($('.'+classId).length > 0){
		return true;
	}
	return false;
}

//绑定单击事件
$(".slideElement").click(function(){
	slideEle($(this));
});

//glyphicon-plus 收缩状态  glyphicon-minus 没有子结构
function slideEle($this){
	var $p = $this.parent().parent();
	var dataId=$p.data("id");
	if(dataId != undefined){
		//if($p.hasClass("p") && $this.hasClass("glyphicon-minus")){
		//	upAction($this);
		//}else
		 if($this.hasClass("glyphicon-plus")){
			$this.removeClass("glyphicon-plus").addClass("glyphicon-minus");
			$("."+dataId).stop(false,true).slideDown();
		}else{
			upAction($this);
		}	
	}
}

function upAction($this){
	var $p = $this.parent().parent();
	var dataId=$p.data("id");
	$this.removeClass("glyphicon-minus").addClass("glyphicon-plus");
	$("."+dataId).each(function(){
		$(this).stop(false,true).slideUp();
		$("."+$(this).data("id")).stop(false,true).slideUp();
	});
	$("."+dataId+" td span.slideElement").each(function(){
		$(this).removeClass("glyphicon-minus");
		if(hasSonEle($(this).parent().parent().data("id"))){
			$(this).addClass("glyphicon-plus");
			upAction($(this));
		}
	});
}

<#if checkbox && casCheck>
		$(".checkid").change(function(){
			changeCheckboxStatus($(this));
		});
		function changeCheckboxStatus($this){
			$parent = $this.parent().parent();
			var dataId=$parent.data("id");
			var cla = $parent.prop("class");
			var sta = $this.prop("checked");
			/***
			if($parent.hasClass("p")){
				downChange(dataId,sta);
			}else if(sta){
				upChange(cla,sta)
				downChange(dataId,sta);// && !$this.prop("checked")
			}else{
				downChange(dataId,sta);
			}
			*/
				downChange(dataId,sta);
		}
		function upChange(cla,sta){
			var $this = $("#"+cla+" td :checkbox");
			if(!$("#"+cla)){
				return false;
			}
			$this.prop("checked",sta);
			changeCheckboxStatus($this);
		}
		function downChange(dataId,sta){
			var $this = $("."+dataId+" td :checkbox");
			if($("."+dataId).length == 0){
				return false;
			}
			$this.prop("checked",sta);
			changeCheckboxStatus($this);
		}
</#if>

<#if values?exists && values?size gt 0>
	<#list values as value>
		$("#"+${value}+" td :checkbox").prop("checked",true);
	</#list>
</#if>

</script>
</#macro>

<#--
判断页面权限，需配合权限组建使用
pcode 权限编码
fcode 功能编码
-->
<#macro sec pcode="" fcode="" >
<#if SecurityContext.hasFunction(Session[BfsuolConstants.SESSION_LOGININFO_KEY].roleCodes,pcode,fcode)>
<#nested>
</#if>
</#macro>
<#--########################以上是组件相关宏##########################-->

<#--########################以下是辅助工具宏##########################-->
<#--截取字符串-->
<#macro cutstring str len=6>
	<#if str?exists && str?length gt len>${str[0..(len-1)]?default("")}...<#else>${str?default("")}</#if> 
</#macro>

<#-- 用户判断islearner -->
<#macro islearner>
	<#if Session[BfsuolConstants.SESSION_LOGININFO_KEY]?exists.userType==Constants.USER_TYPE_LEARNER>
		<#nested>
	</#if>
</#macro>
<#-- 用户判断notlearner -->
<#macro notlearner>
	<#if Session[BfsuolConstants.SESSION_LOGININFO_KEY]?exists.userType!=Constants.USER_TYPE_LEARNER>
		<#nested>
	</#if>
</#macro>
<#-- 用户判断isadmin -->
<#macro isadmin>
	<#if Session[BfsuolConstants.SESSION_LOGININFO_KEY]?exists.loginName=='admin'>
		<#nested>
	</#if>
</#macro>
<#-- 用户判断notadmin -->
<#macro notadmin>
	<#if Session[BfsuolConstants.SESSION_LOGININFO_KEY]?exists.loginName!='admin'>
		<#nested>
	</#if>
</#macro>
<#--########################以上是辅助工具宏##########################-->
